// 引入mongoose
const mongoose = require("mongoose");
const { types } = require("./data/types.js");
// 创建模型
const typesScheme = new mongoose.Schema({
  title: String,
  labels:Array//对应子类型集合
});
const usersModel = mongoose.model("types", typesScheme, "types");

mongoose.connect(
  "mongodb://tangzhenhua:Lovo123456@182.92.214.223:8084/heshumiao_project3",
  {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    auth: { authSource: "admin" },
  },
  async () => {
    // 当连接成功后触发
    // 创建类型数据 一个（对象）或多个（数组）
    await usersModel.create(types);

  }
);


